package com.example.lyonlinemusic.tools;


import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

public class BCryptTest  {
    public static void main(String[] args) {
        String password="123456";
        BCryptPasswordEncoder bCryptPasswordEncoder=new BCryptPasswordEncoder();
        String newPassword=bCryptPasswordEncoder.encode(password);
        System.out.println("加密的密码为:"+newPassword);

        boolean same_password_result=bCryptPasswordEncoder.matches(password,newPassword);
        System.out.println("加密的密码和密码对比结果:"+same_password_result);

    }
}
